﻿using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Dryricenet
{
   
    public partial class home_Iorder : System.Web.UI.Page
    {
        public int id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Name"] == null)
            {
                //登录状态为空
                Response.Write("<script>javascript:alert('对不起,您还没有登录!');history.back();</script>");
                Response.End();
            }
            else if(!IsPostBack)
            {
                string name = Session["Name"].ToString();
                DataTable dt = userBLL.selectNameBll(name);
                DataRow dr = dt.Rows[0];//第一条数据
                id = Convert.ToInt32(dr["UserID"]);
                Refresh(id);
            }
           
        }
        //刷新
        public void Refresh(int id)
        {
            GridView1.DataSource = OrderBLL.orderQTBLL(id);
            GridView1.DataBind();
        }
        //分页
        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            Refresh(id);
        }

        
    }
}